#include "event.hpp"

void Event::Call(Function function, Object* sender)
{
    (*function)(sender);
}

void Event::Attach(Function function)
{
    functions.push_back(function);
}

Event::Event()
    : sender(NULL) {}

Event::~Event() {}

void Event::Notify(Object* sender)
{
    if (functions.size() != 0)
    {
        for (EventIterator it = functions.begin();
            it < functions.end(); it++)
        {
            this->Call(*it, sender);
        }
    }
}
void Event::operator = (void(*function)(Object*)) {
    Attach((Function)function);
}
